import java.awt.event.*;  

int r, g, b;

void setup() {
  size(600,600);
  r = g = b = 255;
  // add mouse wheel listener  
  frame.addMouseWheelListener(new MouseWheelInput());  
}

void draw() {
  r = mouseX;
  g = mouseY;
  fill(r, 0, 0);
  rect(0,500,500,100);
  fill(0, g, 0);
  rect(500,0,100,500);
  fill(0, 0, b);
  rect(500,500,100,100);
  fill(r, g, b);
  rect(0,0,500,500);
}

// convenience class to listen for MouseWheelEvent  
// modify mouseWheelMoved() for your own purposes  
class MouseWheelInput implements MouseWheelListener{  
  void mouseWheelMoved(MouseWheelEvent e) {
    int step = e.getWheelRotation();  
    println(step+" "+millis()); 
    b = b + step*8;  
  }  
}


